package com.web.controller;

import com.web.entity.User;
import com.web.service.UserService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author lenovo
 * @Description
 * @Date2025-3-20 16:51
 */
@CrossOrigin
@RestController
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/login")
    public ResponseResult login(String username,String password){
        User user = userService.login(username, password);
        return new ResponseResult(200,"OK",user);
    }

    @RequestMapping("/updateUser")
    public ResponseResult updateUser(User user){
        userService.updateUser(user);
        return new ResponseResult(200,"OK",null);
    }
}
